package com.zzyl.controller;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.dto.AlertDataHandleDto;
import com.zzyl.entity.AlertData;
import com.zzyl.service.AlertDataService;
import com.zzyl.vo.AlertDataVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description AlertDataController
 * @Author lyh
 * @Date 2024-11-04
 */
@RestController
@Api(tags = "报警数据")
@RequestMapping("/alert-data")
public class AlertDataController extends BaseController {
    @Autowired
    private AlertDataService alertDataService;
    @GetMapping("/pageQuery")
    @ApiOperation("分页查询报警数据")
    public ResponseResult<PageResponse<AlertDataVo>> page(Integer pageNum,Integer pageSize,String deviceName,Long startTime,Long endTime,Long id,Integer status){
        PageResponse<AlertDataVo> pageResponse=alertDataService.page(pageNum,pageSize,deviceName,startTime,endTime,id,status);
        return success(pageResponse);
    }

    @PutMapping("/handleAlertData/{id}")
    @ApiOperation("处理设备报警数据")
    public ResponseResult handleAlertData(@PathVariable Long id, @RequestBody AlertDataHandleDto alertDataHandleDto){
        alertDataService.handleAlertData(alertDataHandleDto,id);

      return success();
    }

}
